<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>商品添加页面</title>
    <script type="text/javascript" src="vue.js"></script>
    <script type="text/javascript" src="axios.min.js"></script>
</head>
<body>
<H1>The Goods Add Page</H1>
<div id="app">
    <ul>
        <li>name:</li>
        <li><input type="text" v-model="name"></li>
        <li>remark:</li>
        <li><textarea rows="5" cols="50" v-model="remark"></textarea></li>
        <li><button v-on:click="insert">Save</button></li>
    </ul>
</div>
</body>
<script>
    var config={
        el:'#app',
        data:{
            name:null,
            remark:null,
        },
        methods:{
            insert:function () {
                debugger;
                // debugger;
                var serverUrl='http://localhost:1314//goods/doInsertGoods?name='+this.name
                +"&remark="+this.remark;
                axios.get(serverUrl)
                    .then(function (res) {
                        debugger;
                        var result=res.data;
                        window.alert(result);
                        this.location.href="goods.html";
                    })
                    .catch()
            }
        }
    }
    var vue=new Vue(config);
</script>
</html>